import './App.less';
import { useRoutes, } from 'react-router-dom'
import { createContext, Fragment,  useState } from 'react';
import useRoutingPermissions from './routers/routes.jsx';




export const Context = createContext();

function App() {

  // const [role, setRole] = useState(()=> JSON.parse(window.sessionStorage.getItem('role')))
  const [role, setRole] = useState(null)
  const element = useRoutes(useRoutingPermissions(JSON.parse(window.sessionStorage.getItem('role'))))


  return (
    <Fragment>
      <Context.Provider value={{ role, setRole }}>
        {element}
      </Context.Provider>
    </Fragment>
  );
}
export default App;
